<template>
  <template v-for="(item, index) in options">
    <template v-if="values.includes(item.value)">
      <span
          v-if="item.elTagType === 'default' || item.elTagType === ''"
          :key="item.value"
          :index="index"
          :class="item.elTagType"
      >{{ item.label }}
      </span>
      <el-tag
          v-else
          :disable-transitions="true"
          :key="item.value"
          :index="index"
          :type="item.elTagType === 'primary' ? '' : item.elTagType"
          :class="item.elTagType"
      >
        {{ item.label }}
      </el-tag>
    </template>
  </template>
</template>

<script>
import { computed } from '@vue/reactivity'

export default {
  name: "DictTag",
  props: {
    options: {
      type: Array,
      default: null,
    },
    value: [Number, String, Array],
  },
  setup(props) {
    const values = computed(() => {
      if (props.value !== null && typeof props.value !== 'undefined') {
        return Array.isArray(props.value) ? props.value : [String(props.value)];
      } else {
        return [];
      }
    })
    return {
      values
    }
  },
  methods: {},
};
</script>
<style scoped>
</style>